#ifndef SNIPPET_SEARCH_HPP_
#define SNIPPET_SEARCH_HPP_

#include <string>
#include <vector>
#include <boost/algorithm/string.hpp>
#include <boost/foreach.hpp>
#include "Snippet.hpp"

#ifndef foreach
# define foreach BOOST_FOREACH
#endif

using std::string;
using std::vector;

using boost::split;
using boost::is_any_of;

typedef vector<string> Keywords;

class SnippetSearch
{
public:
  static int SearchQuery(string query, SnippetList& snippets);
  static Snippet* SearchId(string snippetId, SnippetList& snippets);

protected:
  static int InternalSearch(Keywords& keywords, SnippetList& snippets);
  static bool StringContainsAnyOf(string haystack, Keywords& needles);
};

#endif